package com.ysd.lis.controller.qc;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.qc.QcMaterial;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.request.qc.QcMaterialDto;
import com.ysd.lis.service.qc.QcMaterialService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 员工表
 * 前端控制器
 * </p>
 *
 * @author pengrongshuai
 * @since 2023-12-19
 */
@Api(tags = "质控品")
@RestController
@RequestMapping("/api/qc/qcMaterial")
public class QcMaterialController extends BaseController {

    @Autowired
    QcMaterialService qcMaterialService;

    @ApiOperation("分页查询")
    @GetMapping("/findQcMaterialPageList")
    public Result findQcMaterialPageList(CommonPageDto pageParam){
        return qcMaterialService.findQcMaterialPageList(pageParam);
    }
    @ApiOperation("查询")
    @GetMapping("/findQcMaterialList")
    public Result findQcMaterialList(CommonPageDto pageParam){
        return qcMaterialService.findQcMaterialList(pageParam);
    }
    @ApiOperation("查询")
    @GetMapping("/findMaterialListByQcDate")
    public Result findMaterialListByQcDate(CommonPageDto pageParam){
        return qcMaterialService.findMaterialListByQcDate(pageParam);
    }
    @ApiOperation("查询树形结构")
    @GetMapping("/findMaterialTree")
    public Result findMaterialItemTree(CommonPageDto pageParam){
        return qcMaterialService.findMaterialItemTree(pageParam);
    }
    @ApiOperation("新增")
    @PostMapping("/addQcMaterial")
    public Result addQcMaterial(@RequestBody QcMaterial material){
        return  qcMaterialService.addQcMaterial(material);
    }

    @ApiOperation("修改")
    @PostMapping("/editQcMaterial")
    public Result editQcMaterial(@RequestBody QcMaterial material) {
        return qcMaterialService.editQcMaterial(material);
    }

    @ApiOperation("修改")
    @PostMapping("/editQcMaterialAndBatchItem")
    public Result editQcMaterialAndBatchItem(@RequestBody QcMaterial material) {
        return qcMaterialService.editQcMaterialAndBatchItem(material);
    }


//    @ApiOperation("批量新增")
//    @PostMapping("/batchAddQcInstrItemList")
//    public Result batchAddQcInstrItemList(@RequestBody QcInstrItemDto dto){
//        return  qcInstrItemService.batchAddQcInstrItemList(dto);
//    }

    @ApiOperation("批量删除")
    @PostMapping("/batchDeleteQcMaterialList")
    public Result batchDeleteQcMaterialList(@RequestBody QcMaterialDto dto){
        return  qcMaterialService.batchDeleteQcMaterialList(dto);
    }
}
